<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="node_modules/react/umd/react.development.js"></script>
    <script src="node_modules/react-dom//umd/react-dom.development.js"></script>
    <script src="node_modules/babel-standalone/babel.min.js"></script>
  </head>
  <body>
    <!-- 创建dom 根节点 -->

    <div id="demoReact"></div>

    <script type="text/babel">
      class Com extends React.Component {
        constructor(props) {
          super(props);
          this.state = {
            name: "西西",
          };
        }
        render() {
          return (
            <div>
              <button
                onClick={() => {
                  this.setState({ name: "哈哈" });
                }}
              >
                点我改变数据
              </button>
              <h1>我是一个组件 {this.state.name}</h1>
            </div>
          );
        }
      }

      ReactDOM.render(<Com />, document.getElementById("demoReact"));
    </script>
  </body>
</html>
